﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using BusinessObjects.BO_GetObjects;
using DigiLib;
public partial class Controls_Learningprogram : Admin_Controls_Base {
    protected void Page_Load(object sender, EventArgs e) {
        if(!IsPostBack) {
            LoadData();
        }
    }
    //load data
    public void LoadData() {
        try {
            int cat_id = int.Parse(Request.QueryString["category_id"]);
            base.bindRepeater(rptTitle, BO_portal_articles.SelectByCategory(1, Int32.MaxValue, cat_id, "ARTICLES"));
            if(string.IsNullOrEmpty(Request["ARTICLE_ID"]))
                base.bindRepeater(rptData, BO_portal_articles.SelectTop(1, 1));
            else
                base.bindRepeater(rptData, BO_portal_articles.Search(Convert.ToInt32(Request["ARTICLE_ID"])));
        } catch {

        }
    }

    protected string getActive(string article_id, int index) {
        if(string.IsNullOrEmpty(Request["ARTICLE_ID"])) {
            if(index == 0) {
                return "active2";
            }
        } else {
            if(article_id.Equals(Request["ARTICLE_ID"])) {
                return "active2";
            }
        }
        return "";
    }
}